
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"
	isELIgnored="false"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>

<html>
<head>
<style type="text/css">
.file-preview {
    width: 50% !important;
		height:60% !important;
}
.kv-fileinput-caption{
  width: 50% !important;
}
.input-group {
display: block !important;
}
</style>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<script type="text/javascript" src="<%=request.getContextPath()%>/easyui/jquery.min.js"></script>
<link href="<%=request.getContextPath()%>/css/style.css" rel="stylesheet" type="text/css" />
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/jPages.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/animate.css">
<script src="<%=request.getContextPath()%>/js/jPages.js"></script>

<link rel="stylesheet" href="<%=request.getContextPath()%>/css/fileinput.min.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/css/bootstrap.min.css">
<link rel="stylesheet" href="<%=request.getContextPath()%>/umeditor/themes/default/css/umeditor.css">
<script src="<%=request.getContextPath()%>/js/jquery-3.2.1.min.js"></script>
<script src="<%=request.getContextPath()%>/js/bootstrap.min.js"></script>
<script src="<%=request.getContextPath()%>/js/jquery-bootstrap-pagination.js"></script>
<script src="<%=request.getContextPath()%>/js/fileinput.min.js"></script>
<script src="<%=request.getContextPath()%>/js/zh.js"></script>
 <!--ueditor插件js-->
<script type="text/javascript" src="<%=request.getContextPath()%>/umeditor/third-party/template.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/umeditor/umeditor.config.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/umeditor/umeditor.min.js"></script>
<script type="text/javascript" src="<%=request.getContextPath()%>/umeditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	$(document).ready(function(){
   		$("#upload")
		.fileinput(
				{
					uploadUrl : "/htx-backer/upload/photod",
					uploadAsync : true,
					maxFileCount : 1,
					initialPreview : [ ]
				})
		.on(
				'fileuploaded',
				function(event, data, previewId, index) {
					var form = data.form, files = data.files, extra = data.extra, response = data.response, reader = data.reader;
					if (response.data != null && response.data != "") {
						$("input[name=hidd]").val(response.data.purl);
					} else {
						alert("图片服务器异常，请重新上传！");
					}
				});
   	})
</script>
</head>

<body>

	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><e>首页</e></li>
			<li><e>基础管理</e></li>
			<li><e>升级设置</e></li>
		</ul>
	</div>

	<div class="formbody">


		<div id="usual1" class="usual">

			<div class="itab">
				<ul>
					<li><a href="#tab1" class="selected" style="font-size: 15">升级设置</a></li>

				</ul>
			</div>

			<div id="tab1" class="tabson">
				<ul class="forminfo">
						<li><label>版本号：</label><input 
							name="text" type="text" class="dfinput" value="" />
						</li>
						<li><label>升级描述：</label><textarea id="detailed" class="dfinput" style="width:600px;height:90px;resize:none;"></textarea></li>
						<li><label>上传升级apk：</label><input id="upload" type="file" name="file" multiple
			class="file-loading"> <input id="url" name="hidd"
			type="hidden"></li>

				</ul>
		
                		<div style="margin-left: 50px;">
								<ul class="forminfo" >
					<li><label>是否强制更新：</label>  是：<input name="radio" type="radio" class="qiyong"  value="1" />
    &nbsp;&nbsp;&nbsp;&nbsp;    否：<input name="radio" type="radio" class="tingyong"  value="0" /> </li>
				</ul>
							<input name="" type="button" class="tijiao" value="提交"
						style="width: 96px; height: 35px; line-height: 35px; color: #fff; background: red; font-size: 14px; font-weight: bold; border-radius: 3px; cursor: pointer;" />
				</div>
			</div>

			<script type="text/javascript">
			 
				
				
				$(function() {
					$(".tijiao")
							.click(
									function() {
										var texts = $("input[name=text]")
												.val();
										var detailed = $("#detailed")
										.val();
										var hidd = $("input[name=hidd]")
										.val();
										var is_update = $("input[name='radio']:checked").val();
										if (texts == null || texts == "") {
											alert("请填写版本号");
											return;
										}
										if (detailed == null || detailed == "") {
											alert("请填写升级描述");
											return;
										}
										if (hidd == null || hidd == "") {
											alert("请上传apk");
											return;
										}
										if (is_update == null || is_update == "") {
											alert("请选择是否强制更新！");
											return;
										}
										$
												.ajax({
													type : "get",
													url : "/htx-backer/insertUpgrade",
													data : {
														version : texts,
														address : detailed,
														describe : hidd,
														is_update : is_update,
													},
													dataType : "json",
													success : function(data) {
														if (data.flag > 0) {
															var btn = confirm("提交成功!")
															window.location.href = "/htx-backer/upgrade";
														}
													}
												})
									})
									
   	
				})
			
			</script>
</body>
</html>

